<?php
defined('_JEXEC') or die;
$app = JFactory::getApplication();
$itemid = JRequest::getVar('Itemid');
$menu = &JSite::getMenu();
$active = $menu->getItem($itemid);
$params = $menu->getParams($active->id);
$pageclass = $params->get( 'pageclass_sfx' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/rs.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/tp.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/ms.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/ed.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/media/system/css/modal.css" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseurl ?>/media/system/js/modal.js"></script>
<script type="text/javascript">
		window.addEvent('domready', function() {
			SqueezeBox.initialize({});
			SqueezeBox.assign($$('a.modal'), {
				parse: 'rel'
			});
		});
</script>
<!--[if IE]>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/ie.css" type="text/css" />
<![endif]-->
</head>
<body class="page<?php echo ucfirst($pageclass); ?>">
<div id="main" class="b">
<div class="w">
<div id="tube">
</div>
<div id="sideBar">	
	<div id="logo"><a href="<?php echo JURI::base();?>"></a></div>	
    <div id="mainMenu">    	
    	<jdoc:include type="modules" name="mainmenu" style="menu" />        
    </div>
    <?php if ($this->countModules('sidebar')):?>
       <jdoc:include type="modules" name="sidebar" style="module" />
    <?php endif;?>          
	</div>
<?php if(JRequest::getVar('view')!='featured' || $this->countModules('component')):?>
<div id="mainBody">
	
        	<?php if ($this->countModules( 'before-component' )) : ?>
        	<div id="beforeComponent"><jdoc:include type="modules" name="before-component" style="module" /></div>
			<?php endif;?>
            
            <?php if ($this->countModules( 'before-content' ) && JRequest::getVar('view')=='article' || JRequest::getVar('view')=='item') : ?>
        	<div id="beforeContent"><jdoc:include type="modules" name="before-content" style="module" /></div>
			<?php endif;?>
            
            <?php if(JRequest::getVar('view')=='featured'):?>
            	<?php if($this->countModules('component')):?>
                	<div id="component">
                		<jdoc:include type="modules" name="component" style="component" />
                    </div>
                <?php endif;?>
            <?php else:?>     
           			<div id="component">
            		<jdoc:include type="component" />                            
           		</div>                   
            <?php endif;?>           
            
            <?php if ($this->countModules( 'after-content' ) && JRequest::getVar('view')=='article' || JRequest::getVar('view')=='item') : ?>
        	<div id="afterContent"><jdoc:include type="modules" name="after-content" style="module" /></div>
			<?php endif;?>
            
            <?php if ($this->countModules( 'after-component' )) : ?>
        	<div id="afterComponent"><jdoc:include type="modules" name="after-component" style="module" /></div>
			<?php endif;?>          
        </div>
<?php endif;?>
<div class="clr"></div>
</div>
</div>
<?php if ($this->countModules( 'bottom1 or bottom2 or bottom3 or bottom4' )) : ?>
<div id="bottom" class="b">
	<div class="w">
    	<?php if ($this->countModules( 'bottom1' )) : ?>
        	<div id="bottom1"><jdoc:include type="modules" name="bottom1" style="module" /></div>
		<?php endif;?>
		<?php if ($this->countModules( 'bottom2' )) : ?>
        	<div id="bottom2"><jdoc:include type="modules" name="bottom2" style="module" /></div>
		<?php endif;?>
        <?php if ($this->countModules( 'bottom3' )) : ?>
        	<div id="bottom3"><jdoc:include type="modules" name="bottom3" style="module" /></div>
		<?php endif;?>
        <?php if ($this->countModules( 'bottom4' )) : ?>
        	<div id="bottom4"><jdoc:include type="modules" name="bottom4" style="module" /></div>
		<?php endif;?>
        <div class="clr"></div>
    </div>
</div>
<?php endif;?>
<div id="footer" class="b">
	<div class="w">    	
        <?php if ($this->countModules( 'footer1' )) : ?>
        	<div id="footer1"><jdoc:include type="modules" name="footer1" style="module" /></div>
		<?php endif;?>
        <?php if ($this->countModules( 'footer2' )) : ?>
        	<div id="footer2"><jdoc:include type="modules" name="footer2" style="module" /></div>
		<?php endif;?>
        <div class="clr"></div>
    </div>
</div>

</body>
</html>
